/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastrarEvento.java
 *
 * Created on 25/06/2012, 22:08:27
 */
package View;

import Controller.Controller;
import Model.Artista;
import Model.Sistema;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.swing.JOptionPane;

/**
 *
 * @author Rodrigo
 */
public class CadastrarEvento extends javax.swing.JFrame {

    private Controller controller;

    /** Creates new form CadastrarEvento */
    public CadastrarEvento() {
        initComponents();
        controller = Controller.getInstance();
    }

    /** Creates new form CadastrarEvento */
    public CadastrarEvento(Calendar dataSelecionada) {
        initComponents();
        controller = Controller.getInstance();
        inicioEventoDia.setSelectedIndex(dataSelecionada.getTime().getDate() - 1);
        inicioEventoMes.setSelectedIndex(dataSelecionada.getTime().getMonth());
        inicioEventoAno.setSelectedIndex(dataSelecionada.getTime().getYear() - 112);
        inicioEventoHora.setText(Integer.toString(dataSelecionada.getTime().getHours()));
        inicioEventoMinuto.setText(Integer.toString(dataSelecionada.getTime().getMinutes()));
        fimEventoDia.setSelectedIndex(dataSelecionada.getTime().getDate() - 1);
        fimEventoMes.setSelectedIndex(dataSelecionada.getTime().getMonth());
        fimEventoAno.setSelectedIndex(dataSelecionada.getTime().getYear() - 112);
        fimEventoHora.setText(Integer.toString(dataSelecionada.getTime().getHours()));
        fimEventoMinuto.setText(Integer.toString(dataSelecionada.getTime().getMinutes()));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        nomeEventoTextField = new javax.swing.JTextField();
        Artista1Label = new javax.swing.JLabel();
        artista1TextField = new javax.swing.JTextField();
        Artista2Label = new javax.swing.JLabel();
        artista2TextField = new javax.swing.JTextField();
        artista3TextField = new javax.swing.JTextField();
        Artista3Label = new javax.swing.JLabel();
        PrecoIngressoLabel = new javax.swing.JLabel();
        PrecoIngressoLabel2 = new javax.swing.JLabel();
        PrecoIngressoLabel5 = new javax.swing.JLabel();
        PrecoIngressoLabel6 = new javax.swing.JLabel();
        PrecoIngressoLabel7 = new javax.swing.JLabel();
        PrecoIngressoLabel8 = new javax.swing.JLabel();
        PrecoIngressoLabel9 = new javax.swing.JLabel();
        PrecoIngressoLabel10 = new javax.swing.JLabel();
        precoIngressoTextField = new javax.swing.JTextField();
        inicioEventoDia = new javax.swing.JComboBox();
        inicioEventoMes = new javax.swing.JComboBox();
        inicioEventoAno = new javax.swing.JComboBox();
        tipoAcomodacaoEventoComboBox = new javax.swing.JComboBox();
        nomeProdutorTextField = new javax.swing.JTextField();
        produtoraProdutorTextField = new javax.swing.JTextField();
        valorAluguelEventoTextField = new javax.swing.JTextField();
        porcetagemVendaIngressosEventoTextField = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        tipoEventoTextField = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        artista1GeneroTextField = new javax.swing.JTextField();
        Artista1Label1 = new javax.swing.JLabel();
        Artista1Label2 = new javax.swing.JLabel();
        Artista1Label3 = new javax.swing.JLabel();
        artista2GeneroTextField = new javax.swing.JTextField();
        artista3GeneroTextField = new javax.swing.JTextField();
        PrecoIngressoLabel11 = new javax.swing.JLabel();
        PrecoIngressoLabel12 = new javax.swing.JLabel();
        inicioEventoHora = new javax.swing.JTextField();
        PrecoIngressoLabel13 = new javax.swing.JLabel();
        inicioEventoMinuto = new javax.swing.JTextField();
        PrecoIngressoLabel14 = new javax.swing.JLabel();
        fimEventoMinuto = new javax.swing.JTextField();
        PrecoIngressoLabel15 = new javax.swing.JLabel();
        fimEventoHora = new javax.swing.JTextField();
        PrecoIngressoLabel16 = new javax.swing.JLabel();
        PrecoIngressoLabel17 = new javax.swing.JLabel();
        fimEventoAno = new javax.swing.JComboBox();
        fimEventoMes = new javax.swing.JComboBox();
        fimEventoDia = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Nome do Evento:");

        nomeEventoTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nomeEventoTextFieldActionPerformed(evt);
            }
        });

        Artista1Label.setText("Artista 1:");

        Artista2Label.setText("Artista 2:");

        artista2TextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                artista2TextFieldActionPerformed(evt);
            }
        });

        Artista3Label.setText("Artista 3:");

        PrecoIngressoLabel.setText("Preço do Ingresso:");

        PrecoIngressoLabel2.setText("Início do Evento");

        PrecoIngressoLabel5.setText("Tipo do Evento:");

        PrecoIngressoLabel6.setText("Nome do Produtor:");

        PrecoIngressoLabel7.setText("Nome da Produtora:");

        PrecoIngressoLabel8.setText("Valor do Aluguel:");

        PrecoIngressoLabel9.setText("Porcentagem de vendas de ingressos:");

        PrecoIngressoLabel10.setText("Tipo de Acomodação:");

        inicioEventoDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        inicioEventoDia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inicioEventoDiaActionPerformed(evt);
            }
        });

        inicioEventoMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
        inicioEventoMes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inicioEventoMesActionPerformed(evt);
            }
        });

        inicioEventoAno.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2012", "2013", "2014", "2015", "2016" }));
        inicioEventoAno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inicioEventoAnoActionPerformed(evt);
            }
        });

        tipoAcomodacaoEventoComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Em Pé", "Sentado" }));
        tipoAcomodacaoEventoComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tipoAcomodacaoEventoComboBoxActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24));
        jLabel2.setText("Cadastro de Evento");

        jButton1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jButton1.setText("Salvar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Voltar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        Artista1Label1.setText("Gênero:");

        Artista1Label2.setText("Gênero:");

        Artista1Label3.setText("Gênero:");

        PrecoIngressoLabel11.setText("Data:");

        PrecoIngressoLabel12.setText("Hora:");

        PrecoIngressoLabel13.setText(":");

        PrecoIngressoLabel14.setText(":");

        PrecoIngressoLabel15.setText("Hora:");

        PrecoIngressoLabel16.setText("Data:");

        PrecoIngressoLabel17.setText("Fim do Evento");

        fimEventoAno.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2012", "2013", "2014", "2015", "2016" }));
        fimEventoAno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fimEventoAnoActionPerformed(evt);
            }
        });

        fimEventoMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
        fimEventoMes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fimEventoMesActionPerformed(evt);
            }
        });

        fimEventoDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        fimEventoDia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fimEventoDiaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(255, 255, 255)
                        .addComponent(jLabel2)))
                .addContainerGap(778, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(59, 59, 59)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(PrecoIngressoLabel10)
                            .addComponent(PrecoIngressoLabel9)
                            .addComponent(PrecoIngressoLabel8)
                            .addComponent(PrecoIngressoLabel7)
                            .addComponent(PrecoIngressoLabel5)
                            .addComponent(PrecoIngressoLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(porcetagemVendaIngressosEventoTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
                            .addComponent(valorAluguelEventoTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
                            .addComponent(produtoraProdutorTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
                            .addComponent(nomeProdutorTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
                            .addComponent(tipoAcomodacaoEventoComboBox, 0, 499, Short.MAX_VALUE)
                            .addComponent(tipoEventoTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(152, 152, 152)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(PrecoIngressoLabel17)
                            .addComponent(PrecoIngressoLabel2)
                            .addComponent(Artista1Label)
                            .addComponent(jLabel1)
                            .addComponent(Artista2Label)
                            .addComponent(Artista3Label)
                            .addComponent(PrecoIngressoLabel)
                            .addComponent(PrecoIngressoLabel11)
                            .addComponent(PrecoIngressoLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(inicioEventoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inicioEventoMes, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inicioEventoAno, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PrecoIngressoLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inicioEventoHora, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PrecoIngressoLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(inicioEventoMinuto, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(nomeEventoTextField)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(artista3TextField, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(artista2TextField, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(artista1TextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(Artista1Label1)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(artista1GeneroTextField))
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(Artista1Label3)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(artista3GeneroTextField))
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(Artista1Label2)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(artista2GeneroTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addComponent(precoIngressoTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(fimEventoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(fimEventoMes, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(fimEventoAno, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PrecoIngressoLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(fimEventoHora, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PrecoIngressoLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(fimEventoMinuto, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(530, 530, 530))
            .addGroup(layout.createSequentialGroup()
                .addGap(415, 415, 415)
                .addComponent(jButton1)
                .addContainerGap(791, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(jLabel2)
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeEventoTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista1TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(artista1GeneroTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Artista1Label1)
                    .addComponent(Artista1Label))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Artista1Label2)
                    .addComponent(artista2GeneroTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Artista2Label))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista3TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Artista1Label3)
                    .addComponent(artista3GeneroTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Artista3Label))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(precoIngressoTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel))
                .addGap(44, 44, 44)
                .addComponent(PrecoIngressoLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(inicioEventoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(inicioEventoMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(inicioEventoAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel12)
                    .addComponent(inicioEventoHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel13)
                    .addComponent(inicioEventoMinuto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(PrecoIngressoLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(PrecoIngressoLabel16)
                    .addComponent(fimEventoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fimEventoMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fimEventoAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel15)
                    .addComponent(fimEventoHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel14)
                    .addComponent(fimEventoMinuto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tipoEventoTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeProdutorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(produtoraProdutorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(valorAluguelEventoTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(porcetagemVendaIngressosEventoTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PrecoIngressoLabel9))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tipoAcomodacaoEventoComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(PrecoIngressoLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1))
                    .addComponent(jButton2))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jLabel1.getAccessibleContext().setAccessibleName("Nome do Evento");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void nomeEventoTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nomeEventoTextFieldActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_nomeEventoTextFieldActionPerformed

    private void inicioEventoDiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inicioEventoDiaActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_inicioEventoDiaActionPerformed

    private void inicioEventoMesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inicioEventoMesActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_inicioEventoMesActionPerformed

    private void inicioEventoAnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inicioEventoAnoActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_inicioEventoAnoActionPerformed

    private void tipoAcomodacaoEventoComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tipoAcomodacaoEventoComboBoxActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_tipoAcomodacaoEventoComboBoxActionPerformed

    private void artista2TextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_artista2TextFieldActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_artista2TextFieldActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        List<Artista> artistas = new ArrayList<Artista>();

        String nome = nomeEventoTextField.getText();

        if (!"".equals(artista1TextField.getText())) {
            String nomeArtista1 = artista1TextField.getText();
            String generoArtista1 = artista1GeneroTextField.getText();
            Artista artista1 = new Artista(nomeArtista1, generoArtista1);
            artistas.add(artista1);
        }

        if (!"".equals(artista2TextField.getText())) {
            String nomeArtista2 = artista2TextField.getText();
            String generoArtista2 = artista2GeneroTextField.getText();
            Artista artista2 = new Artista(nomeArtista2, generoArtista2);
            artistas.add(artista2);
        }

        if (!"".equals(artista3TextField.getText())) {
            String nomeArtista3 = artista3TextField.getText();
            String generoArtista3 = artista3GeneroTextField.getText();
            Artista artista3 = new Artista(nomeArtista3, generoArtista3);
            artistas.add(artista3);
        }

        float precoIngresso = Float.valueOf(precoIngressoTextField.getText());
        int numeroIngressos = 120;

        int inicioDia = inicioEventoDia.getSelectedIndex();
        int inicioMes = inicioEventoMes.getSelectedIndex();
        int inicioAno = inicioEventoAno.getSelectedIndex() + 2012;

        int inicioHora = Integer.valueOf(inicioEventoHora.getText());
        int inicioMinuto = Integer.valueOf(inicioEventoMinuto.getText());

        Calendar inicioEvento = Calendar.getInstance();
        inicioEvento.set(inicioAno, inicioMes, inicioDia, inicioHora, inicioMinuto);

        int fimDia = inicioEventoDia.getSelectedIndex();
        int fimMes = inicioEventoMes.getSelectedIndex();
        int fimAno = inicioEventoAno.getSelectedIndex() + 2012;

        int fimHora = Integer.valueOf(fimEventoHora.getText());
        int fimMinuto = Integer.valueOf(fimEventoMinuto.getText());

        Calendar fimEvento = Calendar.getInstance();
        fimEvento.set(fimAno, fimMes, fimDia, fimHora, fimMinuto);

        String tipoEvento = tipoEventoTextField.getText();
        String nomeProdutor = nomeProdutorTextField.getText();
        String produtoraProdutor = produtoraProdutorTextField.getText();

        float valoraluguelEvento = Float.valueOf(valorAluguelEventoTextField.getText());
        float porcentagemvendaingressosEvento = Float.valueOf(porcetagemVendaIngressosEventoTextField.getText());

        String tipoacomodacaoEvento = tipoAcomodacaoEventoComboBox.getSelectedItem().toString();

        boolean adicionadoComSucesso = false;

        if (controller.horarioDisponivel(inicioEvento, fimEvento)) {
            int opcaoSelecionada = JOptionPane.showConfirmDialog(rootPane, "Os dados estão corretos?");
            if (opcaoSelecionada == 0) {
                adicionadoComSucesso = controller.registraEvento(nome, artistas, precoIngresso,
                        numeroIngressos, inicioEvento, fimEvento, tipoEvento, nomeProdutor,
                        produtoraProdutor, valoraluguelEvento, porcentagemvendaingressosEvento,
                        tipoacomodacaoEvento);

                if (adicionadoComSucesso) {
                    TelaGerente tela = new TelaGerente();
                    this.setVisible(false);
                    JOptionPane.showMessageDialog(rootPane, "Evento criado com sucesso.");
                    tela.setVisible(true);
                } else {
                    JOptionPane.showMessageDialog(rootPane, "Este horário está ocupado.");
                }
            }
        } else {
            JOptionPane.showMessageDialog(rootPane, "Esse horário não estã disponível.");
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
        TelaGerente tela = new TelaGerente();
        tela.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void fimEventoAnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fimEventoAnoActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_fimEventoAnoActionPerformed

    private void fimEventoMesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fimEventoMesActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_fimEventoMesActionPerformed

    private void fimEventoDiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fimEventoDiaActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_fimEventoDiaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CadastrarEvento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CadastrarEvento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CadastrarEvento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastrarEvento.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CadastrarEvento().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Artista1Label;
    private javax.swing.JLabel Artista1Label1;
    private javax.swing.JLabel Artista1Label2;
    private javax.swing.JLabel Artista1Label3;
    private javax.swing.JLabel Artista2Label;
    private javax.swing.JLabel Artista3Label;
    private javax.swing.JLabel PrecoIngressoLabel;
    private javax.swing.JLabel PrecoIngressoLabel10;
    private javax.swing.JLabel PrecoIngressoLabel11;
    private javax.swing.JLabel PrecoIngressoLabel12;
    private javax.swing.JLabel PrecoIngressoLabel13;
    private javax.swing.JLabel PrecoIngressoLabel14;
    private javax.swing.JLabel PrecoIngressoLabel15;
    private javax.swing.JLabel PrecoIngressoLabel16;
    private javax.swing.JLabel PrecoIngressoLabel17;
    private javax.swing.JLabel PrecoIngressoLabel2;
    private javax.swing.JLabel PrecoIngressoLabel5;
    private javax.swing.JLabel PrecoIngressoLabel6;
    private javax.swing.JLabel PrecoIngressoLabel7;
    private javax.swing.JLabel PrecoIngressoLabel8;
    private javax.swing.JLabel PrecoIngressoLabel9;
    private javax.swing.JTextField artista1GeneroTextField;
    private javax.swing.JTextField artista1TextField;
    private javax.swing.JTextField artista2GeneroTextField;
    private javax.swing.JTextField artista2TextField;
    private javax.swing.JTextField artista3GeneroTextField;
    private javax.swing.JTextField artista3TextField;
    private javax.swing.JComboBox fimEventoAno;
    private javax.swing.JComboBox fimEventoDia;
    private javax.swing.JTextField fimEventoHora;
    private javax.swing.JComboBox fimEventoMes;
    private javax.swing.JTextField fimEventoMinuto;
    private javax.swing.JComboBox inicioEventoAno;
    private javax.swing.JComboBox inicioEventoDia;
    private javax.swing.JTextField inicioEventoHora;
    private javax.swing.JComboBox inicioEventoMes;
    private javax.swing.JTextField inicioEventoMinuto;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField nomeEventoTextField;
    private javax.swing.JTextField nomeProdutorTextField;
    private javax.swing.JTextField porcetagemVendaIngressosEventoTextField;
    private javax.swing.JTextField precoIngressoTextField;
    private javax.swing.JTextField produtoraProdutorTextField;
    private javax.swing.JComboBox tipoAcomodacaoEventoComboBox;
    private javax.swing.JTextField tipoEventoTextField;
    private javax.swing.JTextField valorAluguelEventoTextField;
    // End of variables declaration//GEN-END:variables
}
